
package cn.bdqn.service;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import cn.bdqn.dao.OpinionMapper;
import cn.bdqn.entity.Opinion;
import cn.bdqn.entity.UsersAndOpinion;
import cn.bdqn.util.Page;
@Service("opinionService")
public class OpinionServiceImpl implements OpinionService {
	@Autowired
	private OpinionMapper opinionMapper;
	@Override
	public Integer saveOpinion(Opinion opinion) {
		return opinionMapper.saveOpinion(opinion);
	}
	@Override
	public List<UsersAndOpinion> queryAllOpinion(Integer userid) {
		return opinionMapper.queryAllOpinion(userid);
	}
	@Override
	public Integer deleteOpinionById(Integer opinionid) {
		return opinionMapper.deleteOpinionById(opinionid);
	}
	@Override
	public void queryAllOpinionbyguan(String context, Page<UsersAndOpinion> page) {
		Integer count=opinionMapper.queryCountOpinion(context);
		page.setTotalCount(count);
		List<UsersAndOpinion> list=opinionMapper.queryAllOpinionByguanli(context, page.getStart(), page.getPageSize());
		page.setList(list);
	}
	@Override
	public Integer updateOpinionStatus(Opinion opinion) {
		return opinionMapper.updateOpinionStatus(opinion);
	}
	@Override
	public UsersAndOpinion queryOpinionByOpinionid(Integer opinionid) {
		return opinionMapper.queryOpinionByOpinionid(opinionid);
	}

}
